<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
<div id="tracking-table-wrapper">
<table id="tracking-table" class="tablesorter sticky-enabled" style="font-size: 12px">
    <thead>
    <tr>
        <th>Seller</th>
        <th class="tracking-campaign">Campaign</th>
        <th class="tracking-date">Date</th>
        <th>Campaign Goal</th>
        <th>Team</th>
        <th>Team Goal</th>
        <th>Individual Goal</th>
        <th>Seller Achievement</th>
        <th>Total Order</th>
    </tr>
    </thead>
	<tbody>
    <?php foreach ($data as $key => $value) : ?>
        <?php if ($options['show_zero_sale'] == 1 || $value[amount_money] != 0): ?>
            <?php
            $total_order = 0;
            foreach ($value['product_list'] as $it) {
                $total_order += $it->qty;
            }
            ?>
            <tr class="orderRow">
                <td><?php echo $value['name']; ?></td>
                <td class="tracking-campaign"><a href="javascript:void(0);" id="campaign_<?php echo $key; ?>"><?php echo $value['campaign_title']; ?></a></td>
                <?php
                $start = explode('T', $value['start_time']);
                $end = explode('T', $value['end_time']);
                ?>
                <td class="tracking-date"><?php echo $start[0] . ' to ' . $end[0]; ?></td>
                <td><?php echo '$' . $value['campaign_goal']; ?></td>
                <td><?php echo $value['team']['title']; ?></td>
                <td><?php echo '$' . $value['team']['goal']; ?></td>
                <td><?php echo '$' . $value['individual_goal']; ?></td>
                <td><?php echo '$' . $value['amount_money']; ?></td>
                <td><?php echo $total_order; ?></td>
            </tr>
            <?php if (isset($value['product_list'])) : ?>
                <?php foreach ($value['product_list'] as $item) : ?>
                    <tr class="expand-child productList campaign_<?php echo $key; ?>">
                        <td></td>
                        <td></td>
                        <td><?php echo $item->title; ?></td>
                        <td><?php echo '$' . ($item->cost + $item->price); ?></td>
                        <td><?php echo $item->qty; ?></td>
                        <td><?php echo '$' . ($item->cost + $item->price) * $item->qty; ?></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                <?php endforeach; ?>
            <?php endif; ?>
        <?php endif; ?>
    <?php endforeach; ?>
    </tbody>
    <tfoot></tfoot>
</table>
</div>
<?php echo $pager; ?>

